﻿/*
输入：
6 7
1 2 1
2 4 -3
2 5 2
1 3 5
3 5 1
4 6 4
5 6 -2
2 6 1
输出：
1
*/
// n个城市，m条路
string[] nm = Console.ReadLine().Split(" ");
int n = int.Parse(nm[0]);
int m = int.Parse(nm[1]);

// 构建图 -- 邻接表
List<(int, int, int)> edges = new List<(int, int, int)>();

for (int i = 0; i < m; i++)
{
    string[] stv = Console.ReadLine().Split(" ");
    int s = int.Parse(stv[0]);
    int t = int.Parse(stv[1]);
    int v = int.Parse(stv[2]);
    edges.Add((s, t, v));
}

string[] sdk = Console.ReadLine().Split(" ");
int source = int.Parse(sdk[0]);
int target = int.Parse(sdk[1]);
int k = int.Parse(sdk[2]);

// Bellman_ford 算法
int[] minDist = new int[n + 1];
Array.Fill(minDist, int.MaxValue);
minDist[source] = 0;
for (int i = 0; i < k; i++)
{
    foreach ((int s, int t, int v) in edges)
    {
        if ( minDist[s] == int.MaxValue) continue;
        minDist[t] = minDist[t] > minDist[s] + v ? minDist[s] + v : minDist[t];
    }
}

Console.WriteLine(minDist[target] == int.MaxValue ? "unreachable":minDist[target]);